home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -in_the_mag- / cologne / mpegagui / mpega.gc < prev    next >
Text File  |  1997-12-06  |  25KB  |  1,035 lines

  1. G4C
  2.  
  3. ; Hi there!
  4. ; This is a Gui4CLI Script. Once runned, it pops up a GUI (Graphical
  5. ; User Interface, in short: a window with buttons) which can be used
  6. ; as a frontend for MPEGA.
  7. ; This script was developed for Gui4CLI version 3+ :
  8. ; > Author   : dck@prometheus.hol.gr (D. Keletsekis)
  9. ; > Type     : Dev/Gui
  10. ; > Version  : 3.1
  11. ; > Requires : WB 2.04 or higher
  12. ; This GUI was developed for MPEGA version 2.9 :
  13. ; > MPEGA V2.9 [68020/30] (C)1995-1997 Stéphane TAVENARD
  14. ; > Release date: May 29 1997 (68020/30)
  15. ; > Email: tavenard@xiii.univ-angers.fr
  16. ; Gui4CLI can be downloaded from AmiNet from the directory dev/gui.
  17. ; MPEGA can be downloaded from AmiNet from the directory mus/play.
  18. ; If you don't like this script you are allowed to change it yourself.
  19. ; If you do so, I would like you to E-mail me your new version.
  20. ; If you change this script and redistribute it, you are not allowed
  21. ; to erase my copyright notice. Feel free to add your own notice.
  22. ; This GUI was developed on a screen resolution of 640*495 pixels.
  23. ; I've tested it on a PAL 640*256 screen and didn't like the window
  24. ; sizes. If you want to run it on a 640*256 screen, you can change
  25. ; the default window sizes. How to do that is perfectly described in
  26. ; the Gui4CLI documentation (Gui4CLI.guide) which comes with the
  27. ; Gui4CLI package. I recommend reading the 'Important Topics! /
  28. ; Window Shortcuts' and the 'COMMANDS / WinBig' sections for that.
  29. ; The MPEGA Executable definition is at line 61. Change it.
  30. ; You also might want to change the default paths the GUI uses.
  31. ; They are at lines 63 and 64 of this file.
  32. ; There are some bugs in this GUI due to the nature of it: it uses
  33. ; the OS multitasking. If you want, you can crash it. Just hit some
  34. ; different buttons with a very short interval. If you think it's lame
  35. ; for that, go buy a faster Miggy...
  36. ; Copyright 1997 M. van Dillen
  37. ; E-mail: 1011071@ibk.fnt.hvu.nl
  38.  
  39.  
  40. WINBIG 1024 11 380 235 'MPEGA GUI v1.1 by Kozmic'
  41. WinType 11110001
  42. WinSmall -1 -1 365 190
  43.  
  44. ICON 180 20 :MPEGA.gc
  45. xArea 180 20 184 29 NONE
  46. GoSub MPEGA.gc about
  47.  
  48. xOnLoad
  49. version = 'MPEGA GUI v1.1'
  50. Extract MPEGA.gc GuiPath KozPath
  51. Exe = 'dh1:music/mpega/mpega'
  52. GoSub MPEGA.gc CheckExe
  53. defaultpath = 'MP3:'
  54. playlistpath = 'MP3:Playlists'
  55. header = '@MP3PLAYLIST@'
  56. stilte = 0
  57. warning = 1
  58. stilte = 1
  59. playing = 0
  60. files = 0
  61. inf = 0
  62. JoinFile $KozPath 'MPEGAGUI.options' opfile
  63. IfExists FILE $opfile
  64.    Copy $opfile 'ENV:.MPEGAGUI.options'
  65.    extra = $.MPEGAGUI.options
  66. ENDIF
  67. JoinFile $KozPath 'MP3Tool' getinfo
  68. JoinFile $KozPath 'TAGEdit.gc' tageditor
  69.  
  70. priority = 0
  71. prio2 = 1
  72. negprio = 0
  73. offset = 0
  74. volume = 128
  75. buffer = 20
  76. maxfreq = 22050
  77. repeat = 'Off'
  78. SetVar mf 'Off'
  79. SetVar wait 'On'
  80. Update MPEGA.gc 1 0        ; mono
  81. Update MPEGA.gc 2 1        ; freq div 2
  82. Update MPEGA.gc 3 1        ; quality
  83. SetGad MPEGA.gc 4 OFF        ; AHI Off
  84. ;SetGad MPEGA.gc 6 OFF        ; buffer disabled
  85. SetGad MPEGA.gc 7 OFF        ; max freq disabled
  86. SetGad MPEGA.gc 17 ON        ; Wait
  87. redraw MPEGA.gc
  88. GuiOpen MPEGA.gc
  89.  
  90. xOnClose
  91. GoSub MPEGA.gc cleanup
  92. GuiQuit Playlist.gc
  93. GuiQuit extra.gc
  94. GuiQuit Info.gc
  95. GuiQuit MPEGA.gc
  96.  
  97.  
  98. ;--- Misc ---
  99.  
  100. xOnKey #13
  101. GoSub MPEGA.gc stop
  102. GoSub MPEGA.gc play
  103.  
  104. xOnKey ' '
  105. GoSub MPEGA.gc stop
  106.  
  107. xOnKey #27
  108. GoSub MPEGA.gc cleanup
  109. GuiQuit Playlist.gc
  110. GuiQuit extra.gc
  111. GuiQuit Info.gc
  112. GuiQuit MPEGA.gc
  113.  
  114. xAppWindow Filenames
  115. ;alle icons verwerken
  116. IF $Filenames > ""
  117.    ;Listview input maken
  118.    files = 0
  119.    CLI 'Echo "" NOLINE > T:MPEGAGUI.temp'
  120.    WHILE $Filenames != ""
  121.       CutVar Filenames CUT WORD 1 eenfile
  122.       APPEND T:MPEGAGUI.temp $eenfile
  123.       IF $files = 0
  124.          Filename = $eenfile
  125.       ENDIF
  126.       CutVar Filenames CUT CHAR 1 space
  127.       IF $Filenames != ""
  128.          APPEND T:MPEGAGUI.temp \n
  129.       ENDIF   
  130.       files == $files + 1
  131.    ENDWHILE
  132.    IF $files > 1
  133.       ;Playlist window init en openen
  134.       GuiLoad Playlist.gc
  135.       LVUse Playlist.gc 1
  136.       LVChange T:MPEGAGUI.temp
  137.       GuiOpen Playlist.gc
  138.    ELSE
  139.       IFEXISTS Window Playlist.gc
  140.          GuiClose Playlist.gc
  141.       ENDIF
  142.    ENDIF
  143.    Update MPEGA.gc 5 'Current file: $Filename'
  144. ENDIF
  145. ;play it!
  146. GoSub MPEGA.gc stop
  147. GoSub MPEGA.gc play
  148.  
  149.  
  150. ;--- Left gadgets ---
  151.  
  152. XCYCLER 88 10 80 18   "_Mode" "mymode"
  153. gadid 1
  154. CStr Mono 0
  155. CStr Stereo 1
  156.  
  157. XCYCLER 88 30 80 18   "Freq _Div" freq
  158. gadid 2
  159. CStr 1 0
  160. CStr 2 1
  161. CStr 4 2
  162.  
  163. XCYCLER 88 50 80 18   "_Quality" "quality"
  164. gadid 3
  165. CStr Worst 0
  166. CStr Good 1
  167. CStr Best 2
  168.  
  169. XTEXTIN 88 74 80 18   "Buffer time" "buffer" "20" 10
  170. gadid 6
  171. IF $buffer = ""
  172.    buffer = "0"
  173.    update MPEGA.gc 6 $buffer
  174. ENDIF
  175. Update MPEGA.gc 5 'Waiting for buffer to be full will now be enabled'
  176.  
  177. xArea 8 74 78 18 NONE
  178. IF $buffer != 20
  179.    buffer = 20
  180.    Update MPEGA.gc 6 $buffer
  181.    Update MPEGA.gc 5 'Buffer reset to $buffer seconds'
  182. ENDIF
  183.  
  184. XTEXTIN 88 94 80 18   "Max Freq" "maxfreq" "22050" 10
  185. gadid 7
  186. Update MPEGA.gc 5 'Maximum decoding frequency will be $maxfreq Hz'
  187.  
  188. XTEXTIN 88 114 80 18   "Mode ID" "ahimode" "20004" 5
  189. gadid 4
  190. Update MPEGA.gc 5 'AHI will now be enabled'
  191.  
  192. XTEXTIN 88 134 80 18   "Stream start" "offset" "0" 10
  193. gadid 9
  194. IF $offset = ""
  195.    offset = "0"
  196.    update MPEGA.gc 9 $offset
  197. ENDIF
  198. Update MPEGA.gc 5 'Playing will start at offset $offset seconds'
  199.  
  200. xArea 8 134 78 18 NONE
  201. IF $offset != 0
  202.    offset = 0
  203.    Update MPEGA.gc 9 $offset
  204.    Update MPEGA.gc 5 'Stream start offset reset to $offset seconds'
  205. ENDIF
  206.  
  207. XHSLIDER 88 158 80 18   "_Volume" "volume" 0 256 128 "%ld"
  208. gadid 18
  209. IF $volume < 65
  210.    Update MPEGA.gc 5 'Volume will be $volume'
  211. ELSE
  212.    Update MPEGA.gc 5 'Volume will be boosted to $volume'
  213. ENDIF
  214.  
  215. xArea 8 158 78 18 NONE
  216. IF $volume != 128
  217.    volume = 128
  218.    Update MPEGA.gc 18 $volume
  219.    Update MPEGA.gc 5 'Volume reset to $volume'
  220. ENDIF
  221.  
  222.  
  223. ;--- Right gadgets ---
  224.  
  225. XCHECKBOX 200 74 26 18   "_Wait for buffer" "wait" "On" "Off" ON
  226. GadID 17
  227. GadTitle RIGHT
  228. IF $wait = "On"
  229.    setgad MPEGA.gc 6 ON
  230.    Update MPEGA.gc 5 'Enter seconds of playback buffer'
  231. ELSE
  232.    setgad MPEGA.gc 6 OFF
  233.    Update MPEGA.gc 5 'Waiting for buffer to be full will now be disabled'
  234. ENDIF
  235.  
  236. XCHECKBOX 200 94 26 18   "Ma_x freq" "mf" "On" "Off" OFF
  237. GadTitle RIGHT
  238. IF $mf = "On"
  239.    setgad MPEGA.gc 7 ON
  240.    setgad MPEGA.gc 2 OFF
  241.    Update MPEGA.gc 5 'Enter maximum playback frequency'
  242. ELSE
  243.    setgad MPEGA.gc 7 OFF
  244.    setgad MPEGA.gc 2 ON
  245.    Update MPEGA.gc 5 'Standard playback frequency will be used'
  246. ENDIF
  247.  
  248. XCHECKBOX 200 114 26 18   "_AHI" "ahi" "On" "Off" OFF
  249. GadTitle RIGHT
  250. IF $ahi = "On"
  251.    setgad MPEGA.gc 4 ON
  252.    Update MPEGA.gc 5 'Enter the AHI Audio mode ID in hex'
  253. ELSE
  254.    setgad MPEGA.gc 4 OFF
  255.    Update MPEGA.gc 5 'AHI will now be disabled'
  256. ENDIF
  257.  
  258. XCHECKBOX 200 134 26 18   "R_epeat song" "repeat" "On" "Off" OFF
  259. GadTitle RIGHT
  260. IF $repeat = "On"
  261.    Update MPEGA.gc 5 'Song will now be repeated'
  262. ELSE
  263.    Update MPEGA.gc 5 "Song won't be repeated"
  264. ENDIF
  265.  
  266. XHSLIDER 266 158 80 18   "P_riority" "priority" -30 30 0 "%ld"
  267. IF $priority < 31
  268.    Update MPEGA.gc 5 'Process priority of MpegA will be $priority'
  269.    negprio = 0
  270. ELSE
  271.    prio2 = 65536
  272.    COUNTER prio2 DEC $priority
  273.    Update MPEGA.gc 5 'Process priority of MpegA will be -$prio2'
  274.    negprio = 1
  275. ENDIF
  276.  
  277.  
  278. ;--- Bottom gadgets ---
  279.  
  280. XBUTTON 5 182 89 20 "P_laylist..."
  281. GoSub Playlist.gc load
  282. IF $files > 1
  283.    ;Playlist window init en openen
  284.    GuiLoad Playlist.gc
  285.    GuiOpen Playlist.gc
  286. ELSE
  287.    IFEXISTS Window Playlist.gc
  288.       GuiClose Playlist.gc
  289.    ENDIF
  290. ENDIF
  291.  
  292. XBUTTON 98 182 89 20   "_Files..."
  293. Set FilePattern #?MP3#?
  294. GoSub MPEGA.gc setwait
  295. ReqFile -1 -1 300 200 "Choose MPEG Audio file(s)" MULTI "Filenames" $defaultpath
  296. GoSub MPEGA.gc setresume
  297.  
  298. IF $Filenames > ""
  299.    ;Listview input maken
  300.    files = 0
  301.    CLI 'Echo "" NOLINE > T:MPEGAGUI.temp'
  302.    WHILE $Filenames != ""
  303.       CutVar Filenames CUT WORD 1 eenfile
  304.       APPEND T:MPEGAGUI.temp $eenfile
  305.       IF $files = 0
  306.          Filename = $eenfile
  307.       ENDIF
  308.       CutVar Filenames CUT CHAR 1 space
  309.       IF $Filenames != ""
  310.          APPEND T:MPEGAGUI.temp \n
  311.       ENDIF   
  312.       files == $files + 1
  313.    ENDWHILE
  314.    IF $files > 1
  315.       ;Playlist window init en openen
  316.       GuiLoad Playlist.gc
  317.       LVUse Playlist.gc 1
  318.       LVChange T:MPEGAGUI.temp
  319.       GuiOpen Playlist.gc
  320.    ELSE
  321.       IFEXISTS Window Playlist.gc
  322.          GuiClose Playlist.gc
  323.       ENDIF
  324.    ENDIF
  325.    Update MPEGA.gc 5 'Current file: $Filename'
  326. ENDIF
  327.  
  328.  
  329. XBUTTON 191 182 89 20   "_PLAY!"
  330. GoSub MPEGA.gc stop
  331. GoSub MPEGA.gc play
  332.  
  333. XBUTTON 284 182 90 20   "_Stop playing"
  334. GoSub MPEGA.gc stop
  335.  
  336. TEXT 5 210 370 18   "Welcome to Kozmic's MPEGA GUI                              " 60 BOX
  337. gadid 5
  338.  
  339.  
  340.  
  341. ;--- Routines ---
  342.  
  343.  
  344. XROUTINE play
  345.  
  346. stilte = 0
  347.  
  348. ;freq div bepalen
  349. DOCASE $freq
  350.    CASE = 0
  351.       SetVar f '1'
  352.    BREAK
  353.    CASE = 1
  354.       SetVar f '2'
  355.    BREAK
  356.    CASE = 2
  357.       SetVar f '4'
  358.    BREAK
  359. ENDCASE
  360.  
  361. ;neg of pos priority bepalen
  362. SetVar prioarg '-p'
  363. IF $negprio = 1
  364.    AppVar prioarg '-$prio2'
  365. ELSE
  366.    AppVar prioarg '$priority'
  367. ENDIF   
  368.  
  369. ;controleren op een hoge priority
  370. warning = 1
  371. IF $priority > 4
  372. AND $negprio = 0
  373. GoSub MPEGA.gc setwait
  374.    EZReq 'Warning! A high priority may lockup your system!' Continue|Cancel warning
  375. GoSub MPEGA.gc setresume
  376. ENDIF
  377.  
  378. ;mode bepalen
  379. SetVar modearg '-n'            ;geen zooi naar stdout
  380. IF $mymode = 0
  381.    AppVar modearg ' -m'
  382. ENDIF
  383.  
  384. ;waardes converteren naar milliseconden
  385. SetVar offs '-S'
  386. AppVar offs '$offset'
  387. AppVar offs '000'
  388. SetVar buff '-t'
  389. AppVar buff '$buffer'
  390. AppVar buff '000'
  391.  
  392. ;volume, wait en maxfreq
  393. SetVar volwaitmf '-v$volume'
  394. IF $wait = 'On'
  395.    AppVar volwaitmf ' $buff -w'
  396. ENDIF
  397. IF $mf = 'On'
  398.    AppVar volwaitmf ' -F$maxfreq'
  399. ENDIF
  400. IF $extra > ""
  401.    AppVar volwaitmf ' $extra'
  402. ENDIF
  403.  
  404. ;play it!
  405. IF $warning = 1
  406.    IF $.MPEGAGUI.inf != $Filename        ;are we playing the same file? (ie. already did a TAG info?)
  407.    AND $inf = 1                    ;do we realy want the slowdown?
  408.       CLI '$getinfo $Filename LFORMAT "%f\\n\\-\\nTitle:   %t\\nArtist:  %a\\nAlbum:   %u\\nGenre:   %g\\nYear:    %y\\nComment: %c\\nBPS:     %b\\nLength:  %d (%e seconds)" >ENV:.MPEGAGUI.inf'
  409.       IFEXISTS Window Info.gc
  410.          ;bug?
  411.       ELSE
  412.          GuiOpen Info.gc
  413.       ENDIF
  414.       LVUse Info.gc 1
  415.       LVChange ENV:.MPEGAGUI.inf
  416.       LVGo last
  417.       LVDel -1
  418.    ENDIF
  419.    LAUNCH 1 '$Exe -d$f -q$quality $modearg $volwaitmf $prioarg $offs $Filename >NIL:'    ;quite important line..
  420.    Update MPEGA.gc 5 'Now playing: $Filename'
  421.    playing == $playing + 1
  422.    nowplaying = $Filename
  423. ELSE
  424.    Update MPEGA.gc 5 'Canceled'        ;cancel in priority warning gekozen
  425. ENDIF
  426.  
  427.  
  428. XOnReturn 1
  429. IF $playing = 1
  430. AND $stilte = 0
  431.    LVUse Playlist.gc 1
  432.    IF $files > 1
  433.       IF $repeat = "Off"
  434.          IF $$lv.rec = $nowplaying        ;geen andere manually chosen
  435.             top == $files - 1
  436.             IF $$lv.line != $top        ;niet? -> next
  437.                LVGo next
  438.             ELSE
  439.                LVGo first
  440.             ENDIF
  441.          ENDIF
  442.       ENDIF
  443.       Filename = $$lv.rec        ;else choose users wish
  444.       GoSub MPEGA.gc play
  445.    ELSE
  446.       IF $repeat = "On"
  447.          GoSub MPEGA.gc play
  448.       ELSE
  449.          Update MPEGA.gc 5 'Finished'
  450.       ENDIF
  451.    ENDIF
  452. ENDIF
  453. playing == $playing - 1
  454.  
  455.  
  456. xOnFail
  457. playing = 0
  458. stilte = 1
  459. Update MPEGA.gc 5 'External error! Returncode: $$RETCODE'
  460.  
  461.  
  462. XROUTINE stop
  463. IF $playing > 0
  464.    CLI 'break `status com "$Exe"` >NIL:'
  465.    Update MPEGA.gc 5 'Playing stopped'
  466.    stilte = 1
  467. ENDIF
  468.  
  469.  
  470. XROUTINE setwait
  471. GuiWindow MPEGA.gc WAIT
  472. GuiWindow Playlist.gc WAIT
  473. GuiWindow extra.gc WAIT
  474. GuiWindow Info.gc WAIT
  475.  
  476.  
  477. XROUTINE setresume
  478. GuiWindow MPEGA.gc RESUME
  479. GuiWindow Playlist.gc RESUME
  480. GuiWindow extra.gc RESUME
  481. GuiWindow Info.gc RESUME
  482.  
  483.  
  484. XROUTINE cleanup
  485. Delete T:MPEGAGUI.temp
  486. Delete ENV:.MPEGAGUI.inf
  487. Delete ENV:.MPEGAGUI.options
  488. Delete ENV:.MPEGAGUI.header
  489. Delete ENV:.MPEGAGUI.filesize
  490. IF $playing > 0
  491.    EZReq 'MPEGA is still running. What shall I do with it?' "Stop it!|Keep it running" stopit
  492.    IF $stopit = 1
  493.       GoSub MPEGA.gc stop        ;let's hope MpegA hasn't finished by itself by now..
  494.    ENDIF
  495. ENDIF
  496.  
  497.  
  498. XROUTINE about
  499. GoSub MPEGA.gc setwait
  500. EZReq "$version \n\nMPEGAGUI is a frontend for MPEGA,\nan MPEG Audio layer 1, 2 and 3 player.\n\nIt is a Gui4CLI script so you need to get\nthe Gui4CLI package e.g. from AmiNet to get\nit running, but you already knew that unless\nyou're reading this script instead of\nrunning it..\n\nIf you don't like it, change it yourself :-)\n\nCopyright 1997 M. van Dillen (1011071@ibk.fnt.hvu.nl)" Cool! egwel
  501. GoSub MPEGA.gc setresume
  502.  
  503.  
  504. XROUTINE CheckExe
  505. IfExists FILE $Exe
  506.    ; bug
  507. Else
  508.    EZReq "MPEGA Executable not found!\nCurrent definition is:\n'$Exe' \n\nYou have to change the 'Exe' definition in the\nfile 'MPEGA.gc' on line number 61\nwith a texteditor.\n\nFor now, you can locate the executable yourself\n(version 2.9+), edit the file 'MPEGA.gc',\nor exit this marvelous GUI.." "Locate MPEGA|Ed MPEGA.gc|Exit" locate
  509.    DOCASE $locate
  510.    CASE = 1
  511.       Set FilePattern #?MPEGA#?
  512.       ReqFile -1 -1 300 200 "Locate the MPEGA Executable" LOAD "Exe" $defaultpath
  513.       BREAK
  514.    CASE = 2
  515.       JoinFile $KozPath 'MPEGA.gc' ThisSux
  516.       CLI 'C:Ed $ThisSux'
  517.       EZReq "Please restart MPEGA.gc now." "Exit" egwel
  518.       GuiQuit Playlist.gc
  519.       GuiQuit extra.gc
  520.       GuiQuit MPEGA.gc
  521.       Stop
  522.       BREAK
  523.    CASE = 0
  524.       GuiQuit Playlist.gc
  525.       GuiQuit extra.gc
  526.       GuiQuit MPEGA.gc
  527.       Stop
  528.       BREAK
  529.    ENDCASE
  530. EndIf
  531.  
  532.  
  533. ;--- Menu's ---
  534.  
  535. xMenu Project "Load Playlist..." "" "L"
  536. GoSub Playlist.gc load
  537. IF $files > 1
  538.    ;Playlist window init en openen
  539.    GuiLoad Playlist.gc
  540.    GuiOpen Playlist.gc
  541. ELSE
  542.    IFEXISTS Window Playlist.gc
  543.       GuiClose Playlist.gc
  544.    ENDIF
  545. ENDIF
  546.  
  547. xMenu Project Play "" "P"
  548. GoSub MPEGA.gc stop
  549. GoSub MPEGA.gc play
  550.  
  551. xMenu Project Stop "" "S"
  552. stilte = 1
  553. GoSub MPEGA.gc stop
  554.  
  555. xMenu Project BARLABEL "" ""
  556.  
  557. xMenu Project "About" "#:MPEGA.gc" ""
  558. GoSub MPEGA.gc about
  559.  
  560. xMenu Project Quit "" "Q"
  561. GuiClose MPEGA.gc
  562.  
  563. xMenu Windows "Extra options..." "" "E"
  564. Update extra.gc 1 $extra
  565. GuiOpen extra.gc
  566.  
  567. xMenu Windows "Toggle Playlist" "" ""
  568. IFEXISTS Window Playlist.gc
  569.    GuiClose Playlist.gc
  570. ELSE
  571.    GuiOpen Playlist.gc
  572. ENDIF
  573.  
  574. xMenu Windows "Toggle MP3 Info" "" "I"
  575. IF $inf = 1
  576.    inf = 0
  577.    GuiClose Info.gc
  578.    Update MPEGA.gc 5 'No info will be searched'
  579. ELSE
  580.    inf = 1
  581.    GuiOpen Info.gc
  582.    Update MPEGA.gc 5 'Songinfo will be searched at playtime'
  583. ENDIF
  584.  
  585. xMenu Misc "Show status" "" ""
  586. IF $playing > 0
  587.    CLI 'List lformat %l $nowplaying > ENV:.MPEGAGUI.filesize'
  588.    Update MPEGA.gc 5 'Now playing: $nowplaying ($.MPEGAGUI.filesize\)'
  589.    Delete ENV:.MPEGAGUI.filesize
  590. ELSE
  591.    Update MPEGA.gc 5 'Idle'
  592. ENDIF
  593.  
  594. xMenu Misc "Run TAGEditor" "" ""
  595. GuiLoad $tageditor
  596.  
  597. ;================================================================================================
  598. ;================================================================================================
  599. ;================================================================================================
  600.  
  601. NEWFILE Playlist.gc
  602.  
  603. WINBIG 1024 267 380 200 'MPEGA GUI Playlist'
  604. WinType 11110001
  605. WinSmall -1 -1 158 100
  606.  
  607. xAppWindow Filenames
  608. IF $Filenames > ""
  609.    ;Listview input maken
  610.    IfExists FILE T:MPEGAGUI.temp
  611.       CLI 'Echo "" >> T:MPEGAGUI.temp'            ;return plakken
  612.    ELSE
  613.       CLI 'Echo "" NOLINE > T:MPEGAGUI.temp'        ;file aanmaken
  614.       files = 0
  615.    ENDIF
  616.    WHILE $Filenames != ""
  617.       CutVar Filenames CUT WORD 1 eenfile
  618.       APPEND T:MPEGAGUI.temp $eenfile
  619.       IF $files = 0
  620.          Filename = $eenfile
  621.       ENDIF
  622.       CutVar Filenames CUT CHAR 1 space
  623.       IF $Filenames != ""
  624.          APPEND T:MPEGAGUI.temp \n
  625.       ENDIF   
  626.       files == $files + 1
  627.    ENDWHILE
  628.    ;Playlist window init en openen
  629.    GuiLoad Playlist.gc
  630.    LVUse Playlist.gc 1
  631.    LVChange T:MPEGAGUI.temp
  632.    GuiOpen Playlist.gc
  633.    Update MPEGA.gc 5 'Current file: $Filename'
  634. ENDIF
  635.  
  636.  
  637. XListView 0 26 -1 174 "" LVFilename T:MPEGAGUI.temp 0 TXT
  638. gadid 1
  639. IF $$lv.rec != 'No Data'
  640.    Filename = $LVFilename
  641.    IF $playing > 0
  642.       Update MPEGA.gc 5 'Next file: $Filename'
  643.    ELSE
  644.       Update MPEGA.gc 5 'Current file: $Filename'
  645.    ENDIF
  646. ENDIF
  647.  
  648. XButton 0 0 76 13 "I"
  649. GadFont gc.font 12 000
  650. LVUse Playlist.gc 1
  651. LVGo first
  652. Filename = $$lv.rec
  653. Update MPEGA.gc 5 'Current file: $Filename'
  654.  
  655. XButton 76 0 76 13 "G"
  656. GadFont gc.font 12 000
  657. LVUse Playlist.gc 1
  658. IF $$lv.line != 0
  659.    LVGo prev
  660.    Filename = $$lv.rec
  661.    Update MPEGA.gc 5 'Current file: $Filename'
  662. ENDIF
  663. GoSub MPEGA.gc stop
  664. GoSub MPEGA.gc play
  665.  
  666. XButton 152 0 76 13 "Sh_uffle"
  667. LVUse Playlist.gc 1
  668. tel = $files
  669. JoinFile $KozPath 'Random' copyarg
  670. Copy $copyarg T:
  671. WHILE $tel > 0
  672.    CLI 'T:Random $tel > env:.MPEGAGUI.random'
  673.    LVGo #$.MPEGAGUI.random
  674.    vorige = $$lv.line
  675.    LVAdd $$lv.rec
  676.    LVGo #$vorige
  677.    LVDel -1
  678.    tel == $tel - 1
  679. ENDWHILE
  680. Delete T:Random
  681. Delete env:.MPEGAGUI.random
  682. LVGo first
  683. Filename = $$lv.rec
  684. Update MPEGA.gc 5 'Current file: $Filename'
  685.  
  686.  
  687. XButton 228 0 76 13 "g"
  688. GadFont gc.font 12 000
  689. LVUse Playlist.gc 1
  690. top == $files - 1
  691. IF $$lv.line != $top
  692.    LVGo next
  693.    Filename = $$lv.rec
  694.    Update MPEGA.gc 5 'Current file: $Filename'
  695. ENDIF
  696. GoSub MPEGA.gc stop
  697. GoSub MPEGA.gc play
  698.  
  699. XButton 304 0 76 13 "i"
  700. GadFont gc.font 12 000
  701. LVUse Playlist.gc 1
  702. LVGo last
  703. Filename = $$lv.rec
  704. Update MPEGA.gc 5 'Current file: $Filename'
  705.  
  706.  
  707. ;--- 2e regel
  708.  
  709. XButton 0 13 76 13 "_Save"
  710. Set FilePattern #?
  711. GoSub MPEGA.gc setwait
  712. playlistfile = ""
  713. ReqFile -1 -1 300 200 "Save Playlist to.." SAVE "playlistfile" $playlistpath
  714. GoSub MPEGA.gc setresume
  715. IF $playlistfile > ""
  716.    IfExists FILE $playlistfile
  717.       EZReq "The file '$playlistfile' already exists!" Replace|Cancel replace
  718.       IF $replace = 1
  719.          CLI 'Echo $header > T:MPEGAGUI.header'
  720.          LVSave T:MPEGAGUI.temp
  721.          CLI 'Type T:MPEGAGUI.header T:MPEGAGUI.temp > $playlistfile'
  722.       ENDIF
  723.    ELSE
  724.       CLI 'Echo $header > T:MPEGAGUI.header'
  725.       LVSave T:MPEGAGUI.temp
  726.       CLI 'Type T:MPEGAGUI.header T:MPEGAGUI.temp > $playlistfile'
  727.    ENDIF
  728. ENDIF
  729.  
  730. XButton 76 13 76 13 "_Load"
  731. GoSub Playlist.gc load
  732.  
  733. XButton 152 13 76 13 "_Add"
  734. Set FilePattern #?MP3#?
  735. GoSub MPEGA.gc setwait
  736. ReqFile -1 -1 300 200 "Choose MPEG Audio file(s)" MULTI "Filenames" $defaultpath
  737. GoSub MPEGA.gc setresume
  738. IF $Filenames > ""
  739.    ;Listview input maken
  740.    IfExists FILE T:MPEGAGUI.temp
  741.       CLI 'Echo "" >> T:MPEGAGUI.temp'            ;return plakken
  742.    ELSE
  743.       CLI 'Echo "" NOLINE > T:MPEGAGUI.temp'        ;anders de file aanmaken
  744.       files = 0
  745.    ENDIF
  746.    WHILE $Filenames != ""
  747.       CutVar Filenames CUT WORD 1 eenfile
  748.       APPEND T:MPEGAGUI.temp $eenfile
  749.       IF $files = 0
  750.          Filename = $eenfile
  751.       ENDIF
  752.       CutVar Filenames CUT CHAR 1 space
  753.       IF $Filenames != ""
  754.          APPEND T:MPEGAGUI.temp \n
  755.       ENDIF   
  756.       files == $files + 1
  757.    ENDWHILE
  758.    IF $files > 1
  759.       ;Playlist window init en openen
  760.       GuiLoad Playlist.gc
  761.       LVUse Playlist.gc 1
  762.       LVChange T:MPEGAGUI.temp
  763.       GuiOpen Playlist.gc
  764.    ELSE
  765.       IFEXISTS Window Playlist.gc
  766.          GuiClose Playlist.gc
  767.       ENDIF
  768.    ENDIF
  769.    Update MPEGA.gc 5 'Current file: $Filename'
  770. ENDIF
  771.  
  772. XButton 228 13 76 13 "_Del"
  773. LVUse Playlist.gc 1
  774. IF $files > 0
  775.    LVDel -1
  776.    files == $files - 1
  777.    top == $files - 1
  778.    IF $$lv.line != $top
  779.    AND $$lv.line != 0
  780.       LVGo next
  781.    ENDIF
  782.    Filename = $$lv.rec
  783.    Update MPEGA.gc 5 'Next file: $Filename'
  784.    LVSave T:MPEGAGUI.temp
  785. ELSE
  786.    Update MPEGA.gc 5 'And.. that was the last one :-)'
  787. ENDIF
  788.  
  789. XButton 304 13 76 13 "_Clear"
  790. LVUse Playlist.gc 1
  791. LVClear
  792. files = 0
  793. IFEXISTS FILE T:MPEGAGUI.temp
  794.    Delete T:MPEGAGUI.temp
  795. ENDIF
  796.  
  797.  
  798. ;--- Routines ---
  799.  
  800. XROUTINE load
  801. Set FilePattern #?
  802. GoSub MPEGA.gc setwait
  803. ReqFile -1 -1 300 200 "Choose a Playlist file" LOAD "playlistfile" $playlistpath
  804. GoSub MPEGA.gc setresume
  805. IF $playlistfile F= $defaultpath
  806. ; bug
  807. ELSE
  808.    IF $playlistfile H= $header
  809.       LVUse Playlist.gc 1
  810.       LVChange $playlistfile
  811.       ;laatste weghalen als ie leeg is (return achter laatste record)
  812.       LVGo last
  813.       IF $$lv.rec = ""
  814.          LVDel -1
  815.       ENDIF
  816.       ;eerste weghalen (header)
  817.       LVGo first
  818.       LVDel -1
  819.       Filename = $$lv.rec
  820.       Update MPEGA.gc 5 'Current file: $Filename'
  821.       files = $$lv.total
  822.       ;opslaan zonder header en return
  823.       LVSave T:MPEGAGUI.temp
  824.    ELSE
  825.       GoSub MPEGA.gc setwait
  826.       EZReq "This is not an MPEGAGUI Playlist file!" "You're right. sorry.|Oh yes it is!" joke
  827.       IF $joke = 0
  828.          EZReq "No way! :-)" Oki.. joke
  829.       ENDIF
  830.       GoSub MPEGA.gc setresume
  831.    ENDIF
  832. ENDIF
  833.  
  834.  
  835. ;--- Menu's ---
  836.  
  837. xMenu Project "Load Playlist..." "" "L"
  838. GoSub Playlist.gc load
  839. IF $files > 1
  840.    ;Playlist window init en openen
  841.    GuiLoad Playlist.gc
  842.    GuiOpen Playlist.gc
  843. ELSE
  844.    IFEXISTS Window Playlist.gc
  845.       GuiClose Playlist.gc
  846.    ENDIF
  847. ENDIF
  848.  
  849. xMenu Project Play "" "P"
  850. GoSub MPEGA.gc stop
  851. GoSub MPEGA.gc play
  852.  
  853. xMenu Project Stop "" "S"
  854. stilte = 1
  855. GoSub MPEGA.gc stop
  856.  
  857. xMenu Project BARLABEL "" ""
  858.  
  859. xMenu Project "About" "#:MPEGA.gc" ""
  860. GoSub MPEGA.gc about
  861.  
  862. xMenu Project Quit "" "Q"
  863. GuiClose MPEGA.gc
  864.  
  865. xMenu Windows "Extra options..." "" "E"
  866. Update extra.gc 1 $extra
  867. GuiOpen extra.gc
  868.  
  869. xMenu Windows "Toggle Playlist" "" ""
  870. GuiClose Playlist.gc
  871.  
  872. xMenu Windows "Toggle MP3 Info" "" "I"
  873. IF $inf = 1
  874.    inf = 0
  875.    GuiClose Info.gc
  876.    Update MPEGA.gc 5 'No info will be searched'
  877. ELSE
  878.    inf = 1
  879.    GuiOpen Info.gc
  880.    Update MPEGA.gc 5 'Songinfo will be searched at playtime'
  881. ENDIF
  882.  
  883. xMenu Misc "Show status" "" ""
  884. IF $playing > 0
  885.    CLI 'List lformat %l $nowplaying > ENV:.MPEGAGUI.filesize'
  886.    Update MPEGA.gc 5 'Now playing: $nowplaying ($.MPEGAGUI.filesize\)'
  887.    Delete ENV:.MPEGAGUI.filesize
  888. ELSE
  889.    Update MPEGA.gc 5 'Idle'
  890. ENDIF
  891.  
  892. xMenu Misc "Run TAGEditor" "" ""
  893. GuiLoad $tageditor
  894.  
  895. ;================================================================================================
  896. ;================================================================================================
  897. ;================================================================================================
  898.  
  899. NEWFILE extra.gc
  900.  
  901. WINBIG -1 -1 380 50 'MPEGA Extra commandline options'
  902. WinType 11010000
  903.  
  904. xOnKey #27
  905. extra = $.MPEGAGUI.options
  906. Update MPEGA.gc 5 'Extra cmdline options not changed'
  907. GuiClose extra.gc
  908.  
  909. XTEXTIN 5 5 370 18 "" "extra" "" 800
  910. gadid 1
  911.  
  912. xButton 14 28 70 18 "_Save"
  913. .MPEGAGUI.options = $extra
  914. Copy ENV:.MPEGAGUI.options $opfile
  915. Update MPEGA.gc 5 'Extra cmdline options saved: $extra'
  916. GuiClose extra.gc
  917.  
  918. xButton 106 28 70 18 "_Use"
  919. Update MPEGA.gc 5 'Extra cmdline options set: $extra'
  920. GuiClose extra.gc
  921.  
  922. xButton 198 28 70 18 "_Restore"
  923. extra = $.MPEGAGUI.options
  924. Update extra.gc 1 $extra
  925.  
  926. xButton 291 28 70 18 "_Cancel"
  927. extra = $.MPEGAGUI.options
  928. Update MPEGA.gc 5 'Extra cmdline options not changed'
  929. GuiClose extra.gc
  930.  
  931. xMenu Project Save "" ""
  932. .MPEGAGUI.options = $extra
  933. Copy ENV:.MPEGAGUI.options $opfile
  934. Update MPEGA.gc 5 'Extra cmdline options saved: $extra'
  935. GuiClose extra.gc
  936.  
  937. xMenu Project Use "" ""
  938. Update MPEGA.gc 5 'Extra cmdline options set: $extra'
  939. GuiClose extra.gc
  940.  
  941. xMenu Project Restore "" ""
  942. extra = $.MPEGAGUI.options
  943. Update extra.gc 1 $extra
  944.  
  945. xMenu Project Cancel "" ""
  946. extra = $.MPEGAGUI.options
  947. Update MPEGA.gc 5 'Extra cmdline options not changed'
  948. GuiClose extra.gc
  949.  
  950. ;================================================================================================
  951. ;================================================================================================
  952. ;================================================================================================
  953.  
  954. NEWFILE Info.gc
  955.  
  956. WINBIG 0 11 244 84 'MPEGA GUI Info'
  957. WinType 11010000
  958. WinSmall -1 -1 158 84
  959.  
  960. xOnClose
  961. Update MPEGA.gc 5 'No info will be searched'
  962. inf = 0
  963.  
  964. xOnKey #27
  965. Update MPEGA.gc 5 'No info will be searched'
  966. inf = 0
  967. GuiClose Info.gc
  968.  
  969. xAppWindow TempFilename
  970. CLI '$getinfo $TempFilename LFORMAT "%f\\n\\-\\nTitle:   %t\\nArtist:  %a\\nAlbum:   %u\\nGenre:   %g\\nYear:    %y\\nComment: %c\\nBPS:     %b\\nLength:  %d (%e seconds)" >ENV:.MPEGAGUI.inf'
  971. LVUse Info.gc 1
  972. LVChange ENV:.MPEGAGUI.inf
  973. LVGo last
  974. LVDel -1
  975.  
  976. XListView 0 0 -1 86 "" LVInfo ENV:.MPEGAGUI.inf 0 TXT
  977. gadid 1
  978.  
  979.  
  980. ;--- Menu's ---
  981.  
  982. xMenu Project "Get info current" "" ""
  983. CLI '$getinfo $nowplaying LFORMAT "%f\\n\\-\\nTitle:   %t\\nArtist:  %a\\nAlbum:   %u\\nGenre:   %g\\nYear:    %y\\nComment: %c\\nBPS:     %b\\nLength:  %d (%e seconds)" >ENV:.MPEGAGUI.inf'
  984. LVUse Info.gc 1
  985. LVChange ENV:.MPEGAGUI.inf
  986. LVGo last
  987. LVDel -1
  988.  
  989. xMenu Project "Get info next" "" ""
  990. LVUse Playlist.gc 1
  991. IF $files > 1
  992.    IF $repeat = "Off"
  993.       IF $$lv.rec = $nowplaying        ;geen andere manually chosen
  994.          top == $files - 1
  995.          IF $$lv.line != $top        ;niet? -> next
  996.             LVGo next
  997.             nextinfo = $$lv.rec
  998.             LVGo prev
  999.          ELSE
  1000.             LVGo first
  1001.             nextinfo = $$lv.rec
  1002.             LVGo last
  1003.          ENDIF
  1004.       ELSE
  1005.          nextinfo = $Filename
  1006.       ENDIF
  1007.    ENDIF
  1008. ELSE
  1009.    IF $repeat = "On"
  1010.       nextinfo = $nowplaying
  1011.    ELSE
  1012.       Stop
  1013.    ENDIF
  1014. ENDIF
  1015. CLI '$getinfo $nextinfo LFORMAT "%f\\n\\-\\nTitle:   %t\\nArtist:  %a\\nAlbum:   %u\\nGenre:   %g\\nYear:    %y\\nComment: %c\\nBPS:     %b\\nLength:  %d (%e seconds)" >ENV:.MPEGAGUI.inf'
  1016. LVUse Info.gc 1
  1017. LVChange ENV:.MPEGAGUI.inf
  1018. LVGo last
  1019. LVDel -1
  1020.  
  1021. xMenu Project BARLABEL "" ""
  1022.  
  1023. xMenu Project "Run TAGEditor" "" ""
  1024. GuiLoad $tageditor
  1025.